#ifndef DECISION_TREE_H_
#define DECISION_TREE_H_
#include<vector>
#include<Node.h>
#include<Datas.h>
#include<Feature.h>
using namespace std;
class DecisionTree{
public:
	DecisionTree():epsoion(0.00001),mode(0),datas(NULL),features(NULL){};
	virtual ~DecisionTree(){}
	void setDatas(Datas* datas){this->datas=datas;}
	void setFeatures(vector<Feature>* features){this->features=features;}
    Node* creat();
    void decision(Data& data,Node* root);
    virtual double selectFun(vector<int> index_data,int index_feature)=0;
    virtual Node* createNode(vector<int> index_data,vector<int> index_feature,double value);
    void print(Node* root);
protected:

    double epsoion;
    /**
     *  0:ID3 1:C4.5 2:cart
     */
    int mode;
    /**
     * 训练数据
     */
    Datas* datas;
    /**
     * 特征
     */
    vector<Feature> * features;
};	
#endif
